package com.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;
import org.springframework.cloud.stream.messaging.Sink;

/**
 * Description:
 *
 * @Autor: Rolin
 * datetime: 05-06-19:56
 */
@EnableBinding(Sink.class)
public class ConsumerController {

    @Value("${server.port}")
    private String serverPort;

    @StreamListener(Sink.INPUT)
    public void consumer(Message<String> message) throws InterruptedException {
        Thread.sleep(2000);
        System.out.println("消费者接收的消息："+message.getPayload() + "\t本机端口："+serverPort);
    }
}
